{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1e6e3ba3-8186-4e94-ba41-005e1e0fdf20",
   "metadata": {},
   "outputs": [],
   "source": [
    "!pip install tensorflow"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "348fc33a-8e6a-4139-875d-01dcab41928e",
   "metadata": {},
   "outputs": [],
   "source": [
    "import tensorflow as tf\n",
    "input=(4,28,28,3)\n",
    "x=tf.random.normal(input)\n",
    "y=tf.keras.layers.Conv2D(2,3,strides=(1,1),padding='VALID',activation='relu',input_shape=input[1:])(x)\n",
    "print(\"y.shape=\",y.shape)"
   ]
  },
  {
   "cell_type": "raw",
   "id": "aacdc906-2b6d-48eb-927f-1ee4b8ce7720",
   "metadata": {},
   "source": [
    "import tensorflow as tf\n",
    "input=tf.constant([[1,1,0,1],[3,-3,4,2],[2,0,1,3],[4,2,-1,0]])\n",
    "x=tf.reshape(input,[1,4,4,1])\n",
    "MaxPool=tf.keras.layers.MaxPool2D(pool_size=(2,2),strides=(2,2),padding='VALID')\n",
    "print(\"MaxPool(x).numpy()=\\n\",MaxPool(x).numpy()）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "012c4f4f-6f48-4fd8-a163-57a9d31d1a74",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
